/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.analysis.businesspartner;

import com.openbravo.bean.erp.viewbean.CustomerPayment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Administrator
 */
public class CustomerPaymentsEntry {
   String name;
   Map<String,List<CustomerPayment>> orderTypePayments;

    public CustomerPaymentsEntry(String name) {
        this.name = name;
        orderTypePayments=new HashMap();
    }

    public void addCustomerPayment(CustomerPayment p){
        String orderType=p.getOrderType();
        List<CustomerPayment> l=orderTypePayments.get(orderType);
        if(l==null){
            l=new ArrayList<CustomerPayment>();
            orderTypePayments.put(orderType, l);
        }
        l.add(p);
    }

    public Double getPaymentTotal(String orderType,String paymentType){
        List<CustomerPayment> l=orderTypePayments.get(orderType);
        for( CustomerPayment p:l)
            if(p.getPaymentType().equalsIgnoreCase(paymentType))
                return p.getM_dTotal();
        return new Double(0);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
